#ifndef __XDATA_H__
#define __XDATA_H__

#include <memory>
#include <memory_resource>

class XData
{
public:
    void *alloc(long long memSize);
    void setSize(long long size);
    void *data();
    bool end();
    void setEnd(bool end);
    long long size();
    ~XData();
    static std::shared_ptr<XData> make_data(
        std::shared_ptr<std::pmr::memory_resource> pool);
private:
    XData() = default;
private:
    bool end_ = false;
    void *data_ = nullptr;
    long long size_ = 0;
    long long memSize_ = 0;
    std::shared_ptr<std::pmr::memory_resource> memPool_;
};

#endif
